<template>
	<view class="container">
		<view class="top" v-if="data">
			<view class='status' v-if="data.status == 0">待付款</view>
			<view class='status' v-if="data.status == 1">待使用</view>
			<view class='status' v-if="data.status == 2">已使用</view>
			<view class='status' v-if="data.status == 3">已取消</view>
			<view class='status' v-if="data.status == 4">申请中</view>
			<view class='status' v-if="data.status == 5">已退款</view>
			<view class='status' v-if="data.status == 6">已拒绝</view>
		</view>
		<view class="product" v-if="data">
			<view class="item">
				<image class="cover" :src="data.cover"></image>
				<view class="right_info">
					<view class="title">{{data.part_title}}</view>
					<view class="price_num">
						<view class="price">¥{{data.price}}</view>
						<view class="num"></view>
					</view>
					<view class="desc">{{data.desc}}</view>
				</view>
			</view><!-- item end -->
		</view>
		
		<view class="order_info" v-if="data != undefined">
			<view class="title">订单信息</view>
			<view class="section">
				<view class="name">订单号：</view>
				<view class="text">{{data.s_no}}</view>
			</view><!--section end-->
			<view class="section">
				<view class="name">下单时间：</view>
				<view class="text">{{data.created_time}}</view>
			</view><!--section end-->
			<view class="section">
				<view class="name">姓名：</view>
				<view class="text">{{data.name}}</view>
			</view><!--section end--><view class="section">
				<view class="name">手机号码：</view>
				<view class="text">{{data.phone}}</view>
			</view><!--section end--><view class="section">
				<view class="name">身份证号码：</view>
				<view class="text">{{data.id_card}}</view>
			</view><!--section end-->
			<view class="section" v-if="data.pay_time">
				<view class="name">支付金额：</view>
				<view class="text">{{data.price}}</view>
			</view><!--section end-->
			<view class="section" v-if="data.pay_time">
				<view class="name">支付时间：</view>
				<view class="text">{{data.pay_time|formatDate}}</view>
			</view><!--section end-->
			<view class="section" v-if="data && data.status == 5">
				<view class="name">退款金额：</view>
				<view class="text">{{data.price}}</view>
			</view><!--section end-->
			<view class="section" v-if="data && data.status == 5">
				<view class="name">退款时间：</view>
				<view class="text">{{data.refund_time|formatDate}}</view>
			</view><!--section end-->
			<view class="section" v-if="data && data.status == 2">
				<view class="name">验票时间：</view>
				<view class="text">{{data.verify_time}}</view>
			</view><!--section end-->
		</view>
		
	</view>
</template>

<script>
	import {
		HTTP_REQUEST_URL
	} from "@/config/app";
	import {water_order_detail} from "@/api/water";
	export default {
		components: {
			
		},
		data() {
			return {
				id:0,
				data:undefined,
			};
		},
		onLoad(options) {
			this.id = options.id
		},
		onShow() {
			this.init()
		},
		computed: {
			
		},
		methods: {
			
			init() {
				let that = this;
				water_order_detail(this.id).then(res => {
					that.data = res.data;
				})
			},
			
		}
	};
</script>

<style lang="scss">
	.container{
		background-color: #F5F5F5;
		padding-bottom: 0;
		padding-bottom: constant(safe-area-inset-bottom);  
		padding-bottom: env(safe-area-inset-bottom); 
	}
	.top{
		display: flex;
		flex-direction: column;
		padding: 30rpx;
		background-color: white;
		align-items: center;
		.status{
			font-size: 30rpx;
			font-weight: bold;
			color: black;
		}
		.time{
			font-size: 28rpx;
			color: red;
			margin-top: 50rpx;
		}
	}
	.product{
		display: flex;
		flex-direction: column;
		padding: 30rpx;
		margin-top: 20rpx;
		background-color: white;
		.item{
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			padding-top: 20rpx;
			padding-bottom: 20rpx;
			.cover{
				width: 200rpx;
				height: 150rpx;
				border-radius: 10rpx;
			}
			.right_info{
				margin-left: 20rpx;
				flex: 1;
				display: flex;
				flex-direction: column;
				.title{
					font-size: 28rpx;
					color: black;
					font-weight: bold;
				}
				.price_num{
					margin-top: 10rpx;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;
					.price{
						font-size: 26rpx;
						color: darkorange;
					}
					.num{
						font-size: 26rpx;
						color: black;
					}
				}
				.desc{
					font-size: 22rpx;
					color: gray;
					margin-top: 10rpx;
				}
			}
		}//item end
	}//product end
	/****/
	
	.ticket{
		margin-top: 0rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		background-color: white;
		padding: 30rpx;
		border-top: 1rpx dashed #f1f1f1;
	}
	
	.order_info{
		display: flex;
		flex-direction: column;
		padding: 30rpx 30rpx 130rpx 30rpx;
		background-color: white;
		margin-top: 20rpx;
		
		.title{
			font-size: 30rpx;
			font-weight: bold;
			padding-bottom: 30rpx;
		}
		.section{
			height: 60rpx;
			display: flex;
			flex-direction: row;
			.name{
				font-size: 28rpx;
				color: dimgray;
				width: 170rpx;
			}
			.text{
				font-size: 28rpx;
				color: black;
			}
		}
	}//order_info end
	.bnt {
		padding-bottom: calc(10rpx + constant(safe-area-inset-bottom));
		padding-bottom: calc(10rpx + env(safe-area-inset-bottom));
		background-color: white;
		display: flex;
		flex-direction: row;
		justify-content: flex-end;
		align-items: center;
		border-top: 1rpx solid #f1f1f1;
		padding-top: 20rpx;
		.btn{
			
			padding: 0rpx 40rpx;
			margin-right: 20rpx;
			height:60rpx;
			line-height: 60rpx;
			text-align: center;
			color: white;
			background-color: #01A1ED;
			border-radius: 30rpx;
		}
		.red{
			background-color: orangered;
		} 
	}
	.footer{
		height: 90rpx;
		position: fixed;
		right: 0;
		bottom: 0;
		left: 0;
		background-color: white;
		display: flex;
		flex-direction: row;
		justify-content: flex-end;
		align-items: center;
		border-top: 1rpx solid #f1f1f1;
		padding-bottom: calc(10rpx + constant(safe-area-inset-bottom));
		padding-bottom: calc(10rpx + env(safe-area-inset-bottom));
		background-color: white;
		.btn{
			padding: 0rpx 40rpx;
			margin-right: 20rpx;
			height:60rpx;
			line-height: 60rpx;
			text-align: center;
			color: white;
			background-color: #01A1ED;
			border-radius: 30rpx;
		}
		.red{
			background-color: orangered;
		} 
	}
	
	.popup-cls{
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
	}
	
	.pop-info{
		width:90%;
		background-color: white;
		display: flex;
		flex-direction: column;
		border-radius: 20rpx;
		margin: 0 auto;
	}
	.pop-top{
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		font-size: 28rpx;
		color: #000000;
		font-weight: bold;
		margin-top: 20rpx;
		text-align: center;
		height: 40rpx;
	}
	
	.center{
		width:90%;
		margin: 30rpx 30rpx 50rpx 30rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
	}
	
	.qr_img{
		width:90%;
		height:450rpx;
	}
	.center-check{
		width:90%;
		margin: 50rpx 40rpx 50rpx 40rpx;
		display: flex;
		flex-direction: column;
		height: 300rpx;
		.pop-content{
			height: 300rpx;
			flex:1;
			.section{
				height: 60rpx;
				line-height: 60rpx;
				display: flex;
				flex-direction: row;
				align-items: center;
				justify-content: space-between;
			}
		}
	}
	.bottom{
		display: flex;
		flex-direction: row;
		justify-content: center;
	}
	.agree-btn{
		flex: 1;
		margin-left: 40rpx;
		margin-right: 40rpx;
		height:80rpx;
		background-color: #01A1ED;
		border-radius: 40rpx;
		color: #FFFFFF;
		text-align: center;
		line-height: 80rpx;
		margin-bottom: 30rpx;
		font-size: 28rpx;
	}
	
</style>
